<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Get info about given date formatted according to the specified format</title>
 </head>
 <body class="docs"><div id="layout">
  <div id="layout-content"><div id="function.date-parse-from-format" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">date_parse_from_format</h1>
  <p class="verinfo">(PHP 5 &gt;= 5.3.0, PHP 7)</p><p class="refpurpose"><span class="refname">date_parse_from_format</span> &mdash; <span class="dc-title">Get info about given date formatted according to the specified format</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.date-parse-from-format-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>date_parse_from_format</strong></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$format</code></span>
   , <span class="methodparam"><span class="type">string</span> <code class="parameter">$date</code></span>
   ) : <span class="type">array</span></div>

  <p class="para rdfs-comment">
   Returns associative array with detailed info about given date.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.date-parse-from-format-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>

    
     <dt>
<code class="parameter">format</code></dt>

     <dd>

      <p class="para">
       Format accepted by <span class="function"><a href="datetime.createfromformat.html" class="function">DateTime::createFromFormat()</a></span>.
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">date</code></dt>

     <dd>

      <p class="para">
       String representing the date.
      </p>
     </dd>

    
   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.date-parse-from-format-returnvalues">
  <h3 class="title">返回值</h3>
  
  <p class="para">
   Returns associative array with detailed info about given date.
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-function.date-parse-from-format-changelog">
  <h3 class="title">更新日志</h3>
  <table class="doctable informaltable">
   
    <thead>
     <tr>
      <th>版本</th>
      <th>说明</th>
     </tr>

    </thead>

    <tbody class="tbody">
     <tr>
      <td>7.2.0</td>
      <td>
       The <em>zone</em> element of the returned array represents
       seconds instead of minutes now, and its sign is inverted. For instance
       <em>-120</em> is now <em>7200</em>.
      </td>
     </tr>

    </tbody>
   
  </table>

 </div>


 <div class="refsect1 examples" id="refsect1-function.date-parse-from-format-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-2704">
    <p><strong>Example #1 <span class="function"><strong>date_parse_from_format()</strong></span> example</strong></p>
    <div class="example-contents">
<div class="phpcode"><pre><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$date&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">"6.1.2009&nbsp;13:00+01:00"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">print_r</span><span style="color: #007700">(</span><span style="color: #0000BB">date_parse_from_format</span><span style="color: #007700">(</span><span style="color: #DD0000">"j.n.Y&nbsp;H:iP"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$date</span><span style="color: #007700">));<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</pre></div>
    </div>

    <div class="example-contents"><p>以上例程会输出：</p></div>
    <div class="example-contents screen">
<div class="cdata"><pre>
Array
(
    [year] =&gt; 2009
    [month] =&gt; 1
    [day] =&gt; 6
    [hour] =&gt; 13
    [minute] =&gt; 0
    [second] =&gt; 0
    [fraction] =&gt; 
    [warning_count] =&gt; 0
    [warnings] =&gt; Array
        (
        )

    [error_count] =&gt; 0
    [errors] =&gt; Array
        (
        )

    [is_localtime] =&gt; 1
    [zone_type] =&gt; 1
    [zone] =&gt; 3600
    [is_dst] =&gt; 
)
</pre></div>
    </div>
   </div>
  </p>
 </div>

 <div class="refsect1 seealso" id="refsect1-function.date-parse-from-format-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="function"><a href="datetime.createfromformat.html" class="function" rel="rdfs-seeAlso">DateTime::createFromFormat()</a> - 根据给定的格式解析日期时间字符串</span></li>
    <li class="member"><span class="function"><a href="checkdate.html" class="function" rel="rdfs-seeAlso">checkdate()</a> - 验证一个格里高里日期</span></li>
   </ul>
  </p>
 </div>

</div></div></div></body></html>